1. Field of the Invention
This invention relates to estimating the size of a data block in a data buffer, and more particularly, relates to creating an estimate for allocating memory to recover the data block from the data buffer.
2. Description of the Related Art
Computer systems regularly write data blocks from their internal memory to a data buffer of an external destination node. Conventional destination nodes may include storage devices, network connections, and transmission devices. The data buffer stores the data block until the data block is written to the destination medium and the transaction is completed, Conventional destination mediums may include magnetic tape, a hard disk drive, an optical storage drive, or a router. The computer system considers the data block write transaction as complete when the data block is written to the data buffer. The memory locations where the data block was stored in the computer system, such as RAM, may be deallocated and overwritten.
If an error occurs that prevents the data block from being written to the destination medium after the location where the data block was stored in computer memory space has been deallocated, the data block will be lost unless the computer system recovers the data block from the data buffer. The computer system recovers the data block by allocating a memory space sufficient to hold the data block in the computer's memory, such as RAM memory. The computer then copies the data block from the data buffer into the memory space.
The computer system does not retain a record of the size of the data block after the data block has been written to the data buffer. Yet the computer system must reserve a memory space sufficiently large to contain the data block, or a portion of the data block may be lost. Computer systems frequently reserve a memory space as large as the entire data buffer to ensure that the memory space is sufficiently large to recover the whole data block.
Reserving a memory space as large as the data buffer, however, may consume significantly more memory than is required to actually recover the data block. Reserving excessive memory increases the processing time required to complete recovery of the data block, potentially putting the successful completion of the recovery at risk. Excessive reservation of memory for recovery operations may also slow down other computer functions that require memory. The degradation of computer performance due to excessive memory reservation may be exacerbated when multiple memory spaces must be allocated to recover multiple data blocks from the data buffer. Recovering multiple data blocks can even consume enough memory to completely stall computer operation.
FIG. 1 is a block diagram illustrating a conventional data processing system 100. The system 100 includes a computer 105, a destination node 110, a memory module 115, a processor module 120, a data buffer 125, and a destination medium 130. The system 100 transfers data blocks from the computer 105 to the destination node 110. The transfer is typically conducted using a bus or computer network 140.
The computer 105 transfers a data block to a destination node 110, copying car the data block from the memory module 115 to the data buffer 125 of the destination node 110. The destination node 110 copies the data block from the data buffer 125 to the destination medium 130 to complete the transfer.
FIG. 2 is block diagram illustrating a memory map 200 of the current technology. The memory map 200 includes a memory module 115, a data buffer 125, one or more memory data blocks 205, one or more buffer data blocks 210, and an allocated memory space 215. The memory map 200 shows the disposition of data blocks in the memory module 115 and the data buffer 125 during a data recovery process.
The computer 105 transfers a memory data block 205c to the destination node 110 by copying the memory data block 205c to the buffer data block 210a in the data buffer 125 as indicated by an arrow 220. Buffer data blocks 210 typically occupy less than the whole data buffer 125. The destination node 110 writes the buffer data block 210a to the destination medium 130 to complete the transfer. If an error condition occurs before the buffer data block 210a can be completely written to the destination medium 130, the computer 105 initiates a data block recovery process to recover the buffer data block 210a. 
The computer 105 reserves the allocated memory space 215 to recover the buffer data block 210a. The allocated memory space 215 must be as large as the buffer data block 210a or a portion of the buffer data block 210a will be lost. The size of the allocated memory space 215 that is typically reserved is equal to the size of the data buffer 125 to assure that no data in the buffer data block 210a is lost. The computer 105 copies the buffer data block 210a to the allocated memory space 215 as indicated by an arrow 225 to complete the data block recovery process.
As can be seen from FIG. 2, the allocated memory space 215 is frequently much larger than is needed to recover the buffer data block 210a. Reserving more memory than is needed is costly. The unused portion of the allocated memory space 215 cannot be used for other computer 105 processes. Reserving a large memory space also takes more processing time than reserving a smaller space. Reserving memory for recovering buffer data blocks 210 will occasionally consume more memory space than is available in the memory module 115, causing the computer 105 to stall.
The reserving of memory space 215 for recovering buffer data blocks 210 and the memory related performance of the computer 105 may be improved if the size of the allocated memory space 215 more closely approximates the size of the recovered buffer data block 210. The computer 105 can more efficiently reserve a smaller memory space equivalent to the size of the buffer data block 210 instead of a larger allocated memory space 215 equal to the size of the data buffer. Reserving memory space equal to the buffer data block 210 size would also reduce the total memory required by the data block recovery procedure, freeing memory from other tasks.
Accordingly a need exists for what is needed is a process, apparatus, and system that estimate the size of a data block to be recovered during an error condition. Beneficially, such a process, apparatus, and system would accelerate the allocation of memory for recovering data blocks and reduce the consumption of memory by the data block recovery procedure.